#include <ros/ros.h>
#include <geometry_msgs/PoseStamped.h>
#include "localization_msgs/localization_msg.h"

ros::Publisher pub_local_;

void PureLocationCallback(const geometry_msgs::PoseStamped::ConstPtr &msg)
{
    localization_msgs::localization_msg new_msg;
    new_msg.header = msg->header;
    new_msg.pose   = msg->pose;
    new_msg.valid_flag = true;
    // printf("seq: %d, %f\n", msg->header.seq, (ros::Time::now()-msg->header.stamp).toSec());
    pub_local_.publish(new_msg);
}

int main(int argc, char ** argv)
{
    ros::init(argc, argv, "transfer_node");
    ros::NodeHandle nh;

    ros::Subscriber sub_local = nh.subscribe("/pure_location", 10, PureLocationCallback);
    pub_local_ = nh.advertise<localization_msgs::localization_msg>("/localization", 10);

    ros::Rate rate(40);
    while (ros::ok())
    {
        ros::spinOnce();
        rate.sleep();
    }
    
    ros::shutdown();
    return 0;
}